package com.distribute.framework.model;

import com.distribute.framework.core.web.helper.Utils;
import java.lang.reflect.Field;
import java.util.Date; 
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;

import javax.annotation.Resource;

import com.distribute.framework.core.web.util.Page;
import com.distribute.framework.core.lang.*; 
import com.distribute.framework.core.web.helper.WebHelper.LzMap;
import com.distribute.framework.core.util.Function;
import com.distribute.framework.core.util.IbatisMap;
import com.distribute.framework.config.*;
import com.distribute.framework.plugin.*;

@namespace("business/carouselconfig")
public @caption("轮播配置") @database(DatabaseNames.distribute_sys) @source("distribute_sys") @table("tb_carousel_config") class TbCarouselConfig implements java.io.Serializable
{
	private static final long serialVersionUID = 1l;
		
	
		
	private @caption("编号") @column("tbcc_id")    @primary  @notnull  @note("  ") Long tbccId;// 主键 非空     
			
 			
 			
 		
	
		
	private @caption("品牌") @column("tbcc_brand")      @relate("$tbccBrand") @RelateClass(Merchant.class)  @note("  ") Long tbccBrand;//     
			
 	private transient Merchant $tbccBrand;//关联对象[品牌信息]
 			
 			
 			
 		
	
		
	private @caption("排序") @column("tbcc_sort")      @note("  数值越大越排前") Integer tbccSort;//  数值越大越排前   
			
 			
 			
 		
	
		
	private @caption("跳转类型") @column("tbcc_type")      @note(" 1:商品页 2:活动页 3:代理卡页 4:合伙人页 5:余额优惠充值  ") Short tbccType;// 1:商品页 2:活动页 3:代理卡页 4:合伙人页 5:余额优惠充值     
			
 			
 			
 		
	
		
	private @caption("图片") @column("tbcc_picture")      @note("  ") String tbccPicture;//     
			
 			
 			
 		
	
		
	private @caption("商品") @column("tbcc_commodity")      @relate("$tbccCommodity") @RelateClass(Commodity.class)  @note("  ") Long tbccCommodity;//     
			
 	private transient Commodity $tbccCommodity;//关联对象[商品信息]
 			
 			
 			
 		
	
		
	private @caption("活动") @column("tbcc_activity")      @relate("$tbccActivity") @RelateClass(TbActivityText.class)  @note("  ") Long tbccActivity;//     
			
 	private transient TbActivityText $tbccActivity;//关联对象[活动软文]
 			
 			
 			
 		
	
	 
	//默认构造函数
	public TbCarouselConfig(){ 
	
	}
	
	//主键构造函数
	public TbCarouselConfig(Long id){
		this.tbccId = id;
	}
	
	/**所有字段构造函数 
	 TbCarouselConfig(
	 	Utils.getLong("brand")//品牌
	 	,Utils.getInteger("sort")//排序
	 	,Utils.getShort("type")//跳转类型
	 	,Utils.getString("picture")//图片
	 	,Utils.getLong("commodity")//商品
	 	,Utils.getLong("activity")//活动
	 )
	**/
	public TbCarouselConfig(Long tbccBrand,Integer tbccSort,Short tbccType,String tbccPicture,Long tbccCommodity,Long tbccActivity){
		
			
			
		this.tbccBrand=tbccBrand;
		
			
		this.tbccSort=tbccSort;
		
			
		this.tbccType=tbccType;
		
			
		this.tbccPicture=tbccPicture;
		
			
		this.tbccCommodity=tbccCommodity;
		
			
		this.tbccActivity=tbccActivity;
		
	}
	
	//设置非空字段
	public TbCarouselConfig setNotNull(){
		
			
			
			
			
			
			
			
		return this;
	}
	
	
		
	/** 编号 [非空]       **/
	public TbCarouselConfig tbccId(Long tbccId){
		this.tbccId = tbccId;
		this.setSeted(F.tbccId);
		return this;
	}
	
		
	/** 品牌  [Merchant]      **/
	public TbCarouselConfig tbccBrand(Long tbccBrand){
		this.tbccBrand = tbccBrand;
		this.setSeted(F.tbccBrand);
		return this;
	}
	
		
	/** 排序     数值越大越排前   **/
	public TbCarouselConfig tbccSort(Integer tbccSort){
		this.tbccSort = tbccSort;
		this.setSeted(F.tbccSort);
		return this;
	}
	
		
	/** 跳转类型    1:商品页 2:活动页 3:代理卡页 4:合伙人页 5:余额优惠充值     **/
	public TbCarouselConfig tbccType(Short tbccType){
		this.tbccType = tbccType;
		this.setSeted(F.tbccType);
		return this;
	}
	
		
	/** 图片        **/
	public TbCarouselConfig tbccPicture(String tbccPicture){
		this.tbccPicture = tbccPicture;
		this.setSeted(F.tbccPicture);
		return this;
	}
	
		
	/** 商品  [Commodity]      **/
	public TbCarouselConfig tbccCommodity(Long tbccCommodity){
		this.tbccCommodity = tbccCommodity;
		this.setSeted(F.tbccCommodity);
		return this;
	}
	
		
	/** 活动  [TbActivityText]      **/
	public TbCarouselConfig tbccActivity(Long tbccActivity){
		this.tbccActivity = tbccActivity;
		this.setSeted(F.tbccActivity);
		return this;
	}
	
	
	
	/**
	* 克隆对象
	**/
	public TbCarouselConfig clone(){
		TbCarouselConfig clone = new TbCarouselConfig();
		
			
			
		clone.tbccBrand=this.tbccBrand;
		
			
		clone.tbccSort=this.tbccSort;
		
			
		clone.tbccType=this.tbccType;
		
			
		clone.tbccPicture=this.tbccPicture;
		
			
		clone.tbccCommodity=this.tbccCommodity;
		
			
		clone.tbccActivity=this.tbccActivity;
		
		return clone;
	}
	
	
	
	
	
	/**
	 * 根据ID取轮播配置
	 * @param id
	 * @return
	 */
	public static @api TbCarouselConfig get(Long id){		
		return getTbCarouselConfigById(id);
	}
	
	
	/**
	 * 设置ID
	 * @param id
	 * @return
	 */
	public void setId(Long id){		
		this.tbccId = id;
	}
	
	
	/**
	 * 获取所有轮播配置
	 * @return
	 */
	public static @api List<TbCarouselConfig> list(Map params,Integer size){
		return getTbCarouselConfigList(params,size);
	}
	/**
	 * 获取轮播配置分页
	 * @return
	 */
	public static @api Page<TbCarouselConfig> page(Integer page,Integer size,Map params){
		return getTbCarouselConfigPage(page, size , params);
	}
	
	
	/**
	 * 根据查询条件取轮播配置
	 * @param params
	 * @return
	 */
	public static @api TbCarouselConfig Get(Map params){
		return getTbCarouselConfig(params);
	}
	/**
	 * 获取轮播配置数
	 * @return
	 */
	public static @api Long count(Map params){
		return getTbCarouselConfigCount(params);
	}
	/**
	 * 获取轮播配置数
	 * @return
	 */
	public static @api <T> T eval(String eval,Map params){
		return getTbCarouselConfigEval(eval,params);
	}
	
	
	/**
	 * 获取轮播配置图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> stats(Map params,C sumKey,C groupKey){
		return getTbCarouselConfigStats(params,sumKey,groupKey,-1);
	}
	/**
	 * 获取轮播配置图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 分组的字段
	 * @param dateType 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> stats(Map params,C sumKey,C groupKey,int dateType){
		return getTbCarouselConfigStats(params,sumKey,groupKey,dateType);
	}
	
	
	/**
	 * 根据ID取轮播配置
	 * @param id
	 * @return
	 */
	public static @api TbCarouselConfig getTbCarouselConfigById(Long id){		
		return getTbCarouselConfigDao().getTbCarouselConfigById(id);
	}
	
	
	/**
	 * 获取id
	 * @return
	 */
	public Long getId(){
		return this.tbccId;
	}
	
	
	
	/**
	 * 根据ID取轮播配置的标识键值
	 * @param id
	 * @return
	 */
	public static @api String getKeyValue(Object key){
		Long id = Utils.parseLong(key);	
		if(id==null || id.longValue()==0 ){
			
			return null;
			
		}
		String value = null;
		
		value = Cache.getValue(TbCarouselConfig.class, id);
				
		if(value==null){
			TbCarouselConfig tbCarouselConfig = get(id);
			if(tbCarouselConfig!=null){
				String strValue = tbCarouselConfig.getTbccId$();
				
				
				Cache.setValue(TbCarouselConfig.class, id ,strValue);
				
				value = strValue;
			}else{
				
				Cache.setValue(TbCarouselConfig.class, id ,"{"+id+"}",30);
				
				value = "{"+id+"}";
			}
		}
		
		/************LAZY3Q_ID_KEYVALUE************/
		/************LAZY3Q_ID_KEYVALUE************/
		return value;
	}	
	
	
	/**
	 * 获取当前对象的键值
	 * @return
	 */
	public String getKeyValue(){
		
		/************LAZY3Q_CODE_KEYVALUE************/
		/************LAZY3Q_CODE_KEYVALUE************/
		String keyValue = this.getTbccId$();
		
		return keyValue;
	}
	
	
	/**
	 * 根据关键字精确查询轮播配置对象
	 * @return
	 */
	public static @api TbCarouselConfig find(String key){
		if(Utils.empty(key))return null;
		Map params = new HashMap();
		if(key.toLowerCase().startsWith("id:"))//如果查询条件以id:开头，则按ID查询
			params.put("tbccId", key.toLowerCase().replaceFirst("id:", ""));					
		else{//按标识查询，精确查询
			String strDefinex = "";
			
			strDefinex="(2=1 "+strDefinex+")";
			params.put("definex",strDefinex);
		}
		
		/************LAZY3Q_CODE_FIND************/
		/************LAZY3Q_CODE_FIND************/
		return TbCarouselConfig.getTbCarouselConfig(params);
	}
	
	
	/**
	 * 根据关键字查询轮播配置
	 * @return
	 */
	public static @api List<Map> query(String key,int size,Map params,Boolean bObject){
		if(Utils.empty((String)params.get("asc")) && Utils.empty((String)params.get("desc")))//如果未传入排序字段
			params.put("desc","tbcc_id");//那么，默认以主键降序，传给Dao层
		String strTerm=key;		
		if(!Utils.empty(strTerm)){
			if(strTerm.toLowerCase().startsWith("id:"))//如果查询条件以id:开头，则按ID查询
				params.put("tbccId", strTerm.toLowerCase().replaceFirst("id:", ""));					
			else//按标识查询，模糊查询请带%
			{
				String strDefinex = "";
				
				strDefinex="(2=1 "+strDefinex+")";
				params.put("definex",strDefinex);
			}
		}
		
		
		/************LAZY3Q_CODE_QUERY************/
		/************LAZY3Q_CODE_QUERY************/
			
		List<TbCarouselConfig> list = page(0,size,params).getResult();
		
		/**
		* OK!取到数据拼成放入Map中，[{value,text,object:{...}},...]
		* value:数据ID，text:数据标识,object,整个对象
		**/
		List<Map> result = new java.util.ArrayList();
		for(TbCarouselConfig tbCarouselConfig:list){
			Map map = new HashMap();
			map.put("key",tbCarouselConfig.getTbccId().toString());
			map.put("value", Utils.js(tbCarouselConfig.getKeyValue()));
			if(bObject==true)
				map.put("object",tbCarouselConfig);
			result.add(map);
		}
		
		
		/************LAZY3Q_AFTER_QUERY************/
		/************LAZY3Q_AFTER_QUERY************/
		
		return result;
	}
	
	
	
	/**
	 * 获取所有轮播配置
	 * @return
	 */
	public static @api List<TbCarouselConfig> getTbCarouselConfigList(Map params,Integer size){
		return getTbCarouselConfigDao().getTbCarouselConfigList(params,0,size);
	}
	
	/**
	 * 获取轮播配置分页
	 * @return
	 */
	public static @api Page<TbCarouselConfig> getTbCarouselConfigPage(Integer page,Integer size,Map params){
		if(page==null)page=0;
		if(size==null)size=20;
		return getTbCarouselConfigDao().getTbCarouselConfigPage(page, size , params);
	}
	
	/**
	 * 根据查询条件取轮播配置
	 * @param params
	 * @return
	 */
	public static @api TbCarouselConfig getTbCarouselConfig(Map params){
		return getTbCarouselConfigDao().getTbCarouselConfig(params);
	}
	
	/**
	 * 保存一个轮播配置
	 * @param tbCarouselConfig
	 * @return
	 */
	public static @api TbCarouselConfig saveTbCarouselConfig(TbCarouselConfig tbCarouselConfig){
		return getTbCarouselConfigDao().saveTbCarouselConfig(tbCarouselConfig);
	}
	
	/**
	 * 根据条件更新轮播配置
	 * @param values
	 * @param params
	 */
	public static @api int updateTbCarouselConfigByConfirm(Map values, Map params){
		return getTbCarouselConfigDao().updateTbCarouselConfigByConfirm(values,params);
	}
	
	/**
	 * 修改一个轮播配置
	 * @param tbCarouselConfig
	 * @return
	 */
	public static @api int updateTbCarouselConfig(TbCarouselConfig tbCarouselConfig){
		return getTbCarouselConfigDao().updateTbCarouselConfig(tbCarouselConfig);
	}
	
	/**
	 * 更新轮播配置非空字段
	 * @param tbCarouselConfig
	 */
	public static @api int updateTbCarouselConfig$NotNull(TbCarouselConfig tbCarouselConfig){
		return getTbCarouselConfigDao().updateTbCarouselConfig$NotNull(tbCarouselConfig);
	}
	
	/**
	 * 获取轮播配置数
	 * @return
	 */
	public static @api Long getTbCarouselConfigCount(Map params){
		return getTbCarouselConfigDao().getTbCarouselConfigCount(params);
	}
		
		
	/**
	 * 获取轮播配置自定义求和表达式,比如求和:eval="sum(id)"
	 * @return
	 */	
	public static @api <T> T getTbCarouselConfigEval(String eval,Map params){
		return getTbCarouselConfigDao().getTbCarouselConfigEval(eval,params);
	}
	
	
	/**
	 * 获取轮播配置图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 分组的字段
	 * @param dateType 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> getTbCarouselConfigStats(Map params,C sumKey,C groupKey,int dateType){
		//TODO:图表统计功能未实现
		
		Map<String,Object> groups=new HashMap();//要分组的字段
		Map<String,Object> sums=new HashMap();//要统计的字段
		
		String[][] dateFormats=new String[][]{
				null,
				new String[]{"%Y","yyyy年","Y"},
				new String[]{"%Y-%m","yyyy年MM月","M"},
				new String[]{"%Y%U","yyyy年第ww周","W"},
				new String[]{"%Y-%m-%d","yyyy年MM月dd日","D"},
				new String[]{"%Y-%m-%d %H","yyyy年MM月dd日 HH点","H"},
				new String[]{"%m","MM月"},
				new String[]{"%d","dd号"},
				new String[]{"%H","HH点"} 
		};
		
		//获取要分组的字段，放入Map中
		if(dateType>0){
			groups.put(groupKey.toString(),"DATE_FORMAT({key},'"+dateFormats[dateType][0]+"')");
		}else{
			groups.put(groupKey.toString(),"{key}");
		}
		if(dateType<6 && dateType>0){ 
			params.put("asc", groupKey.toString()); 
			if(params.get(groupKey.name()+"Start")==null){
				params.put(groupKey.name()+"Start", Utils.date(new Date(), -24, dateFormats[dateType][2]));
			}
		}
		
		
		//获取要统计的字段，放入Map中
		if(sumKey.toString().equals("count")){
			sums.put(sumKey.toString(),"count(*)");
		}else{
			sums.put(sumKey.toString(),"sum({key})");
		}
		
		List<Map> list = getTbCarouselConfigDao().getTbCarouselConfigStats(params,groups,sums);
		
		List<Map> result = new ArrayList();
		for(Map m:list){
			Map map = new HashMap();
			Object value = m.get(sumKey.toString());
			Object name = null;
			Object groupValue = m.get(groupKey.toString());
			if(dateType>0){
				name = Utils.date(Utils.parseDate(groupValue), dateFormats[dateType][1]);
			}else{
				try{
					java.lang.reflect.Method method = TbCarouselConfig.class.getMethod("get"+Utils.ForMat(groupKey.toString())+"$");
					method.setAccessible(true);
					name = method.invoke(TbCarouselConfig.fromMap(m));
				}catch(Exception ex){
					ex.printStackTrace();
				}
			}
			map.put("name", name);
			map.put("value", value);
			result.add(map);
		}
		return result;
	}
	
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static int updateTbCarouselConfig(Map set,Map where){
		if(set.isEmpty())throw new RuntimeException("set为空");
		if(where.isEmpty())throw new RuntimeException("where为空");
		where.put("confirm", "1");
		return getTbCarouselConfigDao().updateTbCarouselConfigByConfirm(set, where);
	}
	
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static void deleteTbCarouselConfig(Map where){
		if(where.isEmpty())throw new RuntimeException("where为空");
		where.put("confirm", "1");
		getTbCarouselConfigDao().deleteTbCarouselConfigByConfirm(where);
	}
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static void delete(Long id){
		if(id==null)throw new RuntimeException("id为空");
		
		getTbCarouselConfigDao().deleteTbCarouselConfigById(id);
		
	}
	
	
	/**
	 * 保存轮播配置对象
	 * @param params
	 * @return
	 */
	public TbCarouselConfig save(){
		if(this.getTbccId()!=null)
			getTbCarouselConfigDao().updateTbCarouselConfig(this);
		else
			return getTbCarouselConfigDao().saveTbCarouselConfig(this);
		return this;
	}
	
	
	/**
	 * 更新轮播配置对象的非空字段,注意跟Service里面的update不一样哦
	 * @param params
	 * @return
	 */
	public int update(){
		return getTbCarouselConfigDao().updateTbCarouselConfig$NotNull(this);
	}
	
	
	/**
	 * 删除
	 * @param params
	 * @return
	 */
	public void delete(){
		
			getTbCarouselConfigDao().deleteTbCarouselConfigById(this.getTbccId());
	}
	
	/**
	 * 执行事务
	 * @param function
	 */
	public static <T> T execute(Function function){
		return getTbCarouselConfigDao().executeTransaction(function);
	}

	
	
	/*******************************编号**********************************/	
	/**
	* 编号 [非空]      
	**/
	public Long getTbccId(){
		
		if(this.tbccId!=null){
			return this.tbccId;
		}
		
		return this.tbccId;
	}
	/**
	* 获取编号格式化(toString)
	**/
	public String getTbccId$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbccId());
	 
	 	 return strValue;
	}
	/**
	* 根据编号反格式化
	**/
	public void setTbccId$(String strValue){
		if(Utils.empty(strValue)){
			this.tbccId=null;
			return;
		}
	
	
	 	this.tbccId=Utils.parseLong(strValue);
	 
	}
	
	/**
	* 编号 [非空]      
	**/
	public void setTbccId(Long tbccId){
		this.tbccId = tbccId;
		
		this.setSeted(F.tbccId);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************品牌**********************************/	
	/**
	* 品牌  [Merchant]     
	**/
	public Long getTbccBrand(){
		
		if(this.tbccBrand!=null){
			return this.tbccBrand;
		}
		
		return this.tbccBrand;
	}
	/**
	* 获取品牌格式化(toString)
	**/
	public String getTbccBrand$(){
		String strValue="";
	
	
		 
		if(this.getTbccBrand()!=null){
			
				strValue+=Utils.string(Merchant.getKeyValue(this.getTbccBrand()));
			
		}			
		 
	 
	 	 return strValue;
	}
	/**
	* 根据品牌反格式化
	**/
	public void setTbccBrand$(String strValue){
		if(Utils.empty(strValue)){
			this.tbccBrand=null;
			return;
		}
	
	
		 
		Merchant item = Merchant.find(strValue);
		if(item!=null){
			
			this.tbccBrand = Utils.parseLong(item.getId());
			
		}
		 
	 
	}
	
	/**
	* 品牌  [Merchant]     
	**/
	public void setTbccBrand(Long tbccBrand){
		this.tbccBrand = tbccBrand;
		
		this.setSeted(F.tbccBrand);
		
	}
	
	
		 
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 		
	/**
	* 获取关联对象[品牌信息]
	**/	 			
 	public Merchant get$tbccBrand(){
 		if(this.$tbccBrand!=null)
 			return this.$tbccBrand;
 		com.distribute.framework.model.Merchant merchant = null;
		if(this.getTbccBrand()!=null){
		
 			merchant = Merchant.get(this.getTbccBrand());
 		
 		}
 		return merchant;
	}
	
 	
	
	
	/*******************************排序**********************************/	
	/**
	* 排序     数值越大越排前  
	**/
	public Integer getTbccSort(){
		
		if(this.tbccSort!=null){
			return this.tbccSort;
		}
		
		return this.tbccSort;
	}
	/**
	* 获取排序格式化(toString)
	**/
	public String getTbccSort$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbccSort());
	 
	 	 return strValue;
	}
	/**
	* 根据排序反格式化
	**/
	public void setTbccSort$(String strValue){
		if(Utils.empty(strValue)){
			this.tbccSort=null;
			return;
		}
	
	
	 	this.tbccSort=Utils.parseInteger(strValue);
	 
	}
	
	/**
	* 排序     数值越大越排前  
	**/
	public void setTbccSort(Integer tbccSort){
		this.tbccSort = tbccSort;
		
		this.setSeted(F.tbccSort);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************跳转类型**********************************/	
	/**
	* 跳转类型    1:商品页 2:活动页 3:代理卡页 4:合伙人页 5:余额优惠充值    
	**/
	public Short getTbccType(){
		
		if(this.tbccType!=null){
			return this.tbccType;
		}
		
		return this.tbccType;
	}
	/**
	* 获取跳转类型格式化(toString)
	**/
	public String getTbccType$(){
		String strValue="";
	
	
		
			
		 if(Utils.equals(Utils.string(this.getTbccType()),"1"))
			strValue=Utils.string("商品页");		 
			
		 if(Utils.equals(Utils.string(this.getTbccType()),"2"))
			strValue=Utils.string("活动页");		 
			
		 if(Utils.equals(Utils.string(this.getTbccType()),"3"))
			strValue=Utils.string("代理卡页");		 
			
		 if(Utils.equals(Utils.string(this.getTbccType()),"4"))
			strValue=Utils.string("合伙人页");		 
			
		 if(Utils.equals(Utils.string(this.getTbccType()),"5"))
			strValue=Utils.string("余额优惠充值");		 
			
		
	 
	 	 return strValue;
	}
	/**
	* 根据跳转类型反格式化
	**/
	public void setTbccType$(String strValue){
		if(Utils.empty(strValue)){
			this.tbccType=null;
			return;
		}
	
	
		
			
		 if(Utils.equals(strValue,"商品页"))
		 	this.tbccType=Utils.parseShort("1");
			
		 if(Utils.equals(strValue,"活动页"))
		 	this.tbccType=Utils.parseShort("2");
			
		 if(Utils.equals(strValue,"代理卡页"))
		 	this.tbccType=Utils.parseShort("3");
			
		 if(Utils.equals(strValue,"合伙人页"))
		 	this.tbccType=Utils.parseShort("4");
			
		 if(Utils.equals(strValue,"余额优惠充值"))
		 	this.tbccType=Utils.parseShort("5");
			
		
	 
	}
	
	/**
	* 跳转类型    1:商品页 2:活动页 3:代理卡页 4:合伙人页 5:余额优惠充值    
	**/
	public void setTbccType(Short tbccType){
		this.tbccType = tbccType;
		
		this.setSeted(F.tbccType);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************图片**********************************/	
	/**
	* 图片       
	**/
	public String getTbccPicture(){
		
		if(this.tbccPicture!=null){
			return this.tbccPicture;
		}
		
		return this.tbccPicture;
	}
	/**
	* 获取图片格式化(toString)
	**/
	public String getTbccPicture$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getTbccPicture());
	 
	 	 return strValue;
	}
	/**
	* 根据图片反格式化
	**/
	public void setTbccPicture$(String strValue){
		if(Utils.empty(strValue)){
			this.tbccPicture=null;
			return;
		}
	
	
		this.tbccPicture=Utils.parseString(strValue);
	 
	}
	
	/**
	* 图片       
	**/
	public void setTbccPicture(String tbccPicture){
		this.tbccPicture = tbccPicture;
		
		this.setSeted(F.tbccPicture);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************商品**********************************/	
	/**
	* 商品  [Commodity]     
	**/
	public Long getTbccCommodity(){
		
		if(this.tbccCommodity!=null){
			return this.tbccCommodity;
		}
		
		return this.tbccCommodity;
	}
	/**
	* 获取商品格式化(toString)
	**/
	public String getTbccCommodity$(){
		String strValue="";
	
	
		 
		if(this.getTbccCommodity()!=null){
			
				strValue+=Utils.string(Commodity.getKeyValue(this.getTbccCommodity()));
			
		}			
		 
	 
	 	 return strValue;
	}
	/**
	* 根据商品反格式化
	**/
	public void setTbccCommodity$(String strValue){
		if(Utils.empty(strValue)){
			this.tbccCommodity=null;
			return;
		}
	
	
		 
		Commodity item = Commodity.find(strValue);
		if(item!=null){
			
			this.tbccCommodity = Utils.parseLong(item.getId());
			
		}
		 
	 
	}
	
	/**
	* 商品  [Commodity]     
	**/
	public void setTbccCommodity(Long tbccCommodity){
		this.tbccCommodity = tbccCommodity;
		
		this.setSeted(F.tbccCommodity);
		
	}
	
	
		 
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 		
	/**
	* 获取关联对象[商品信息]
	**/	 			
 	public Commodity get$tbccCommodity(){
 		if(this.$tbccCommodity!=null)
 			return this.$tbccCommodity;
 		com.distribute.framework.model.Commodity commodity = null;
		if(this.getTbccCommodity()!=null){
		
 			commodity = Commodity.get(this.getTbccCommodity());
 		
 		}
 		return commodity;
	}
	
 	
	
	
	/*******************************活动**********************************/	
	/**
	* 活动  [TbActivityText]     
	**/
	public Long getTbccActivity(){
		
		if(this.tbccActivity!=null){
			return this.tbccActivity;
		}
		
		return this.tbccActivity;
	}
	/**
	* 获取活动格式化(toString)
	**/
	public String getTbccActivity$(){
		String strValue="";
	
	
		 
		if(this.getTbccActivity()!=null){
			
				strValue+=Utils.string(TbActivityText.getKeyValue(this.getTbccActivity()));
			
		}			
		 
	 
	 	 return strValue;
	}
	/**
	* 根据活动反格式化
	**/
	public void setTbccActivity$(String strValue){
		if(Utils.empty(strValue)){
			this.tbccActivity=null;
			return;
		}
	
	
		 
		TbActivityText item = TbActivityText.find(strValue);
		if(item!=null){
			
			this.tbccActivity = Utils.parseLong(item.getTbatId());
			
		}
		 
	 
	}
	
	/**
	* 活动  [TbActivityText]     
	**/
	public void setTbccActivity(Long tbccActivity){
		this.tbccActivity = tbccActivity;
		
		this.setSeted(F.tbccActivity);
		
	}
	
	
		 
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 		
	/**
	* 获取关联对象[活动软文]
	**/	 			
 	public TbActivityText get$tbccActivity(){
 		if(this.$tbccActivity!=null)
 			return this.$tbccActivity;
 		com.distribute.framework.model.TbActivityText tbActivityText = null;
		if(this.getTbccActivity()!=null){
		
 			tbActivityText = TbActivityText.get(this.getTbccActivity());
 		
 		}
 		return tbActivityText;
	}
	
 	
	
	
	
	/************LAZY3Q_DEFINE_CODE************/
	/************LAZY3Q_DEFINE_CODE************/	
	
	
	/**
	 * 触发器
	 */
	public static void on(Trigger.Index index,final Notify.Listener listener,Trigger.Type... types){
		Notify.on(TbCarouselConfig.class, index, listener, types);
	}
	public static void on(final Notify.Listener listener,String type){
		Notify.on(TbCarouselConfig.class, listener, type);
	}
	/**
	 * 当修改字段时
	 * @param filedName
	 * @param listener
	 */
	public static void on(String filedName,final Notify.Listener listener){
		Notify.on(TbCarouselConfig.class, listener, filedName);
	}
	/**
	 * 当修改字段为某值时
	 * @param filedName
	 * @param value
	 * @param listener
	 */
	public static void on(String filedName,Object value,final Notify.Listener listener){
		if(value==null)return;
		Notify.on(TbCarouselConfig.class, listener, filedName+"."+Utils.md5(""+value));
	}
	public void notify(String type){
		Trigger.on(TbCarouselConfig.class,type, this);
	}
	
	
	/**
	 * 用来获取当有字段关联对象时的获取方式,调用如${TbCarouselConfig.obj.filedName}
	 * 因为有些变态的模板语言不能识别$，所以不能以${TbCarouselConfig.$filedName}获取关联对象
	 */
	public Map getObj(){
		return new HashMap(){
			@Override
			public Object get(Object key) {
				try {
					return TbCarouselConfig.class.getMethod("get$"+Utils.forMat(key.toString())).invoke(TbCarouselConfig.this);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
			}
		};
	}
	/**
	 * 用来获取某字段格式化的获取方式,调用如${TbCarouselConfig.fmt.filedName}
	 * 因为有些变态的模板语言不能识别$，所以不能以${TbCarouselConfig.filedName$}获取某字段格式化
	 */
	public Map getFmt(){
		return new HashMap(){
			@Override
			public Object get(Object key) {
				try {
					return TbCarouselConfig.class.getMethod("get"+Utils.ForMat(key.toString()+"$")).invoke(TbCarouselConfig.this);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
			}
		};
	}
	/**
	 * 获取查询参数链式串
	 * @return
	 */
	public static @Deprecated M where(){ return new M(0); }
	public static @Deprecated M m(){ return new M(0); }
	public static M where = new M(0,true);
	public static @database(DatabaseNames.distribute_sys) class M extends IbatisMap{
		int type = 0; 
		M linked = null;
		Boolean proxy = false;
		public M set = null;
		public M(int type){
			this.type = type;
			if(this.type==0){
				set = new M(1,true);
				set.linked = this;
			}
		};
		public M(int type,Boolean proxy){
			this.type = type;
			this.proxy=proxy;
		};
		public M proxy(){
			M m = new M(this.type);//当前的对像
			if(this.type==0){
				m.set = new M(1,true);//set对象
				m.set.linked = m;
			}else{
				m.linked=this.linked;
				this.linked.linked=m;
			}
			return m;
		}
		public @Deprecated M set(){			
			M m = this;
			m.linked=new M(1);
			m.linked.linked=m;
			return m.linked;
		};
		
		public M on(IbatisMap value,C column,String joinColumn){if(proxy)return proxy().on(value,column,joinColumn);this.put(value.getClass().getDeclaringClass().getSimpleName(), value);value.put("on", column.toString());value.put("to", joinColumn);return this;};
		
		
			
		
		/** 编号 [非空]       **/
		public M tbccId(Object tbccId){if(proxy)return proxy().tbccId(tbccId);  this.put("tbccId", tbccId);return this;};
	 	/** and tbcc_id is null */
 		public M tbccIdNull(){if(proxy)return proxy().tbccIdNull();if(this.get("tbccIdNot")==null)this.put("tbccIdNot", "");this.put("tbccId", null);return this;};
 		/** not .... */
 		public M tbccIdNot(){if(proxy)return proxy().tbccIdNot();this.put("tbccIdNot", "not");return this;};
 		public M tbccIdNotNull(){if(proxy)return proxy().tbccIdNotNull();this.put("tbccIdNot", "not");this.put("tbccId", null);return this;};
 		public M tbccIdNot(Object tbccId){if(proxy)return proxy().tbccIdNot(tbccId);this.put("tbccIdNot", "not");this.put("tbccId", tbccId);return this;};
	 		
		/** and tbcc_id <= ? */
		public M tbccIdMin(Object min){if(proxy)return proxy().tbccIdMin(min);this.put("tbccIdMin", min);return this;};
		/** and tbcc_id >= ? */
		public M tbccIdMax(Object max){if(proxy)return proxy().tbccIdMax(max);this.put("tbccIdMax", max);return this;};
			
			
		public M tbccIdIn(String ids){
			if(proxy)return proxy().tbccIdIn(ids);  this.put("tbccIdIn", ids);return this;
		};	
 			
		
			
	 	
			
		public M tbccBrand$on(Merchant.M value){if(proxy)return proxy().tbccBrand$on(value);this.put("TbccBrand", value);value.put("on", "tbcc_brand");return this;};
 				
 			
		
		/** 品牌  [Merchant]      **/
		public M tbccBrand(Object tbccBrand){if(proxy)return proxy().tbccBrand(tbccBrand);  this.put("tbccBrand", tbccBrand);return this;};
	 	/** and tbcc_brand is null */
 		public M tbccBrandNull(){if(proxy)return proxy().tbccBrandNull();if(this.get("tbccBrandNot")==null)this.put("tbccBrandNot", "");this.put("tbccBrand", null);return this;};
 		/** not .... */
 		public M tbccBrandNot(){if(proxy)return proxy().tbccBrandNot();this.put("tbccBrandNot", "not");return this;};
 		public M tbccBrandNotNull(){if(proxy)return proxy().tbccBrandNotNull();this.put("tbccBrandNot", "not");this.put("tbccBrand", null);return this;};
 		public M tbccBrandNot(Object tbccBrand){if(proxy)return proxy().tbccBrandNot(tbccBrand);this.put("tbccBrandNot", "not");this.put("tbccBrand", tbccBrand);return this;};
	 		
			
		public M tbccBrandIn(String ids){
			if(proxy)return proxy().tbccBrandIn(ids);  this.put("tbccBrandIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 排序     数值越大越排前   **/
		public M tbccSort(Object tbccSort){if(proxy)return proxy().tbccSort(tbccSort);  this.put("tbccSort", tbccSort);return this;};
	 	/** and tbcc_sort is null */
 		public M tbccSortNull(){if(proxy)return proxy().tbccSortNull();if(this.get("tbccSortNot")==null)this.put("tbccSortNot", "");this.put("tbccSort", null);return this;};
 		/** not .... */
 		public M tbccSortNot(){if(proxy)return proxy().tbccSortNot();this.put("tbccSortNot", "not");return this;};
 		public M tbccSortNotNull(){if(proxy)return proxy().tbccSortNotNull();this.put("tbccSortNot", "not");this.put("tbccSort", null);return this;};
 		public M tbccSortNot(Object tbccSort){if(proxy)return proxy().tbccSortNot(tbccSort);this.put("tbccSortNot", "not");this.put("tbccSort", tbccSort);return this;};
	 		
		/** and tbcc_sort <= ? */
		public M tbccSortMin(Object min){if(proxy)return proxy().tbccSortMin(min);this.put("tbccSortMin", min);return this;};
		/** and tbcc_sort >= ? */
		public M tbccSortMax(Object max){if(proxy)return proxy().tbccSortMax(max);this.put("tbccSortMax", max);return this;};
			
			
		public M tbccSortIn(String ids){
			if(proxy)return proxy().tbccSortIn(ids);  this.put("tbccSortIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 跳转类型    1:商品页 2:活动页 3:代理卡页 4:合伙人页 5:余额优惠充值     **/
		public M tbccType(Object tbccType){if(proxy)return proxy().tbccType(tbccType);  this.put("tbccType", tbccType);return this;};
	 	/** and tbcc_type is null */
 		public M tbccTypeNull(){if(proxy)return proxy().tbccTypeNull();if(this.get("tbccTypeNot")==null)this.put("tbccTypeNot", "");this.put("tbccType", null);return this;};
 		/** not .... */
 		public M tbccTypeNot(){if(proxy)return proxy().tbccTypeNot();this.put("tbccTypeNot", "not");return this;};
 		public M tbccTypeNotNull(){if(proxy)return proxy().tbccTypeNotNull();this.put("tbccTypeNot", "not");this.put("tbccType", null);return this;};
 		public M tbccTypeNot(Object tbccType){if(proxy)return proxy().tbccTypeNot(tbccType);this.put("tbccTypeNot", "not");this.put("tbccType", tbccType);return this;};
	 		
			
		public M tbccTypeIn(String ids){
			if(proxy)return proxy().tbccTypeIn(ids);  this.put("tbccTypeIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 图片        **/
		public M tbccPicture(Object tbccPicture){if(proxy)return proxy().tbccPicture(tbccPicture);  this.put("tbccPicture", tbccPicture);return this;};
	 	/** and tbcc_picture is null */
 		public M tbccPictureNull(){if(proxy)return proxy().tbccPictureNull();if(this.get("tbccPictureNot")==null)this.put("tbccPictureNot", "");this.put("tbccPicture", null);return this;};
 		/** not .... */
 		public M tbccPictureNot(){if(proxy)return proxy().tbccPictureNot();this.put("tbccPictureNot", "not");return this;};
 		public M tbccPictureNotNull(){if(proxy)return proxy().tbccPictureNotNull();this.put("tbccPictureNot", "not");this.put("tbccPicture", null);return this;};
 		public M tbccPictureNot(Object tbccPicture){if(proxy)return proxy().tbccPictureNot(tbccPicture);this.put("tbccPictureNot", "not");this.put("tbccPicture", tbccPicture);return this;};
	 		
			
		
			
	 	
			
		public M tbccCommodity$on(Commodity.M value){if(proxy)return proxy().tbccCommodity$on(value);this.put("TbccCommodity", value);value.put("on", "tbcc_commodity");return this;};
 				
 			
		
		/** 商品  [Commodity]      **/
		public M tbccCommodity(Object tbccCommodity){if(proxy)return proxy().tbccCommodity(tbccCommodity);  this.put("tbccCommodity", tbccCommodity);return this;};
	 	/** and tbcc_commodity is null */
 		public M tbccCommodityNull(){if(proxy)return proxy().tbccCommodityNull();if(this.get("tbccCommodityNot")==null)this.put("tbccCommodityNot", "");this.put("tbccCommodity", null);return this;};
 		/** not .... */
 		public M tbccCommodityNot(){if(proxy)return proxy().tbccCommodityNot();this.put("tbccCommodityNot", "not");return this;};
 		public M tbccCommodityNotNull(){if(proxy)return proxy().tbccCommodityNotNull();this.put("tbccCommodityNot", "not");this.put("tbccCommodity", null);return this;};
 		public M tbccCommodityNot(Object tbccCommodity){if(proxy)return proxy().tbccCommodityNot(tbccCommodity);this.put("tbccCommodityNot", "not");this.put("tbccCommodity", tbccCommodity);return this;};
	 		
			
		public M tbccCommodityIn(String ids){
			if(proxy)return proxy().tbccCommodityIn(ids);  this.put("tbccCommodityIn", ids);return this;
		};	
 			
		
			
	 	
			
		public M tbccActivity$on(TbActivityText.M value){if(proxy)return proxy().tbccActivity$on(value);this.put("TbccActivity", value);value.put("on", "tbcc_activity");return this;};
 				
 			
		
		/** 活动  [TbActivityText]      **/
		public M tbccActivity(Object tbccActivity){if(proxy)return proxy().tbccActivity(tbccActivity);  this.put("tbccActivity", tbccActivity);return this;};
	 	/** and tbcc_activity is null */
 		public M tbccActivityNull(){if(proxy)return proxy().tbccActivityNull();if(this.get("tbccActivityNot")==null)this.put("tbccActivityNot", "");this.put("tbccActivity", null);return this;};
 		/** not .... */
 		public M tbccActivityNot(){if(proxy)return proxy().tbccActivityNot();this.put("tbccActivityNot", "not");return this;};
 		public M tbccActivityNotNull(){if(proxy)return proxy().tbccActivityNotNull();this.put("tbccActivityNot", "not");this.put("tbccActivity", null);return this;};
 		public M tbccActivityNot(Object tbccActivity){if(proxy)return proxy().tbccActivityNot(tbccActivity);this.put("tbccActivityNot", "not");this.put("tbccActivity", tbccActivity);return this;};
	 		
			
		public M tbccActivityIn(String ids){
			if(proxy)return proxy().tbccActivityIn(ids);  this.put("tbccActivityIn", ids);return this;
		};	
 			
		
			
	 	
	 	public M add(String key, Object value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	 	public M add(F key, Object value) {if(proxy)return proxy().add(key,value);this.put(key.toString(), value);return this;}
	 	
	 	public M desc(C key) {if(proxy)return proxy().desc(key);this.put("desc", key.column);return this;}
	 	public M asc(C key) {if(proxy)return proxy().asc(key);this.put("asc", key.column);return this;}
	 	public M desc(String sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	 	public M asc(String sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	 	public M definex(String sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	 	
	 	/** 获取所有轮播配置 **/
		public @api List<TbCarouselConfig> list(Integer size){			
			return getTbCarouselConfigList(this,size);
		}
		/** 获取轮播配置分页 **/
		public @api Page<TbCarouselConfig> page(Integer page,Integer size){			
			return getTbCarouselConfigPage(page, size , this);
		}
		/** 根据查询条件取轮播配置 **/
		public @api TbCarouselConfig get(){			
			return getTbCarouselConfig(this);
		}
		/** 获取轮播配置数 **/
		public @api Long count(){			
			return getTbCarouselConfigCount(this);
		}
		/** 获取轮播配置表达式 **/
		public @api <T> T eval(String strEval){			
			return getTbCarouselConfigEval(strEval,this);
		}
		
		/** 获取轮播配置统计 **/
		public @api List<Map> stats(C sumKey,C groupKey,int dateType){			
			return getTbCarouselConfigStats(this,sumKey,groupKey,dateType);
		}
		/** 获取轮播配置统计 **/
		public @api List<Map> stats(C sumKey,C groupKey){			
			return getTbCarouselConfigStats(this,sumKey,groupKey,-1);
		}
		
		/** 根据条件更新 **/
		public @api int update(){			
			M where = null;
			M set = null;
			if(this.type==0){
				if(this.linked==null)throw new RuntimeException("未发set");
				where = this;
				set = this.linked;
			}else{
				if(this.linked==null)throw new RuntimeException("未发where条件");
				set = this;
				where = this.linked;
			}
			return updateTbCarouselConfig(set,where);
		}
		/** 根据条件删除 **/
		public @api void delete(){			
			deleteTbCarouselConfig(this);
		}
	}
	
	public static class Param extends M{
		public Param(int type) {
			super(type);
		}
		public Param(int type, Boolean proxy) {
			super(type, proxy);
		}
	}
	
	/** 对象的字段描述 **/
	public static class F{
		
			
		/** 编号 [非空]       **/
		public final static @type(Long.class)  String tbccId="tbccId";
	 			
			
	 	
			
		/** 品牌  [Merchant]      **/
		public final static @type(Long.class)  String tbccBrand="tbccBrand";
	 			
			
	 	
			
		/** 排序     数值越大越排前   **/
		public final static @type(Integer.class)  String tbccSort="tbccSort";
	 			
		/** and tbcc_sort >= ? */
		public final static @type(Integer.class) String tbccSortMin="tbccSortMin";
		/** and tbcc_sort <= ? */
		public final static @type(Integer.class) String tbccSortMax="tbccSortMax";
				
			
	 	
			
		/** 跳转类型    1:商品页 2:活动页 3:代理卡页 4:合伙人页 5:余额优惠充值     **/
		public final static @type(Short.class)  String tbccType="tbccType";
	 			
			
	 	
			
		/** 图片        **/
		public final static @type(String.class)  String tbccPicture="tbccPicture";
	 			
			
	 	
			
		/** 商品  [Commodity]      **/
		public final static @type(Long.class)  String tbccCommodity="tbccCommodity";
	 			
			
	 	
			
		/** 活动  [TbActivityText]      **/
		public final static @type(Long.class)  String tbccActivity="tbccActivity";
	 			
			
	 	
	 	public static String get(String name){
			try {
				Field field = F.class.getField(name);
				if(field!=null)
					return field.get(null).toString();
			} catch (Exception e) {
				//e.printStackTrace();
			}
			return null;
		}
	}
	
	
	
	/** 对象的数据库字段描述 **/
	public static enum C{
		
		tbccId("tbcc_id"),
		tbccBrand("tbcc_brand"),
		tbccSort("tbcc_sort"),
		tbccType("tbcc_type"),
		tbccPicture("tbcc_picture"),
		tbccCommodity("tbcc_commodity"),
		tbccActivity("tbcc_activity"),
		count("count");
		String column;
		C(String column){
			this.column = column;
		}
		public String toString(){
			return this.column;
		}
		public static String get(String name){
			try {
				Field field = C.class.getField(name);
				if(field!=null)
					return field.get(null).toString();
			} catch (Exception e) {
				//e.printStackTrace();
			}
			return null;
		}
	}
	
	
	
	
	/**
	* 获取轮播配置数据
	**/
	public static Object getData(Object param){
		if(param==null)
			return null;
		Object value = null;
		if(param.getClass()==Long.class)
			value = TbCarouselConfig.get((Long)param);
		else if(param instanceof java.util.Map){
			java.util.Map params = (Map) param;
			if(params.get("size")==null)
				value = TbCarouselConfig.getTbCarouselConfig(params);
			else
				value = TbCarouselConfig.getTbCarouselConfigList(params, (Integer) params.get("size"));
		}else if(param.getClass()==Long.class )
			value =  TbCarouselConfig.where().tbccId(param).get();
		else if(!Utils.empty(param.toString()))
			value = TbCarouselConfig.get(Long.valueOf(param.toString()));
		return value;
	}
	
	/**对象转json**/
	public Map toJSON(){
		return toJSON(false);
	}
	public Map toJSON(boolean simple){
		return toJSON(simple,0);
	}
	public Map toJSON(boolean simple,int step){
		Map map = new HashMap();
		map.put("id",this.getTbccId());
	
		Utils.fms(map,simple?"id":"tbccId",this.getTbccId(),this.getTbccId$());
		
			
 		
	
		Utils.fms(map,simple?"brand":"tbccBrand",this.getTbccBrand(),this.getTbccBrand$());
		
			
 		
	
		Utils.fms(map,simple?"sort":"tbccSort",this.getTbccSort(),this.getTbccSort$());
		
			
 		
	
		Utils.fms(map,simple?"type":"tbccType",this.getTbccType(),this.getTbccType$());
		
			
 		
	
		Utils.fms(map,simple?"picture":"tbccPicture",this.getTbccPicture(),this.getTbccPicture$());
		
			
 		
	
		Utils.fms(map,simple?"commodity":"tbccCommodity",this.getTbccCommodity(),this.getTbccCommodity$());
		
			
 		
	
		Utils.fms(map,simple?"activity":"tbccActivity",this.getTbccActivity(),this.getTbccActivity$());
		
			
 		
	
		if(this.suffix!=null)map.put("suffix", this.suffix);
		
		/************LAZY3Q_DEFINE_TOJSON************/
		/************LAZY3Q_DEFINE_TOJSON************/
		return map;
	}
	/**对象转map**/
	public Map toMap(){
		Map map = new HashMap();
	
		map.put("tbccId",this.getTbccId());
 		
	
		map.put("tbccBrand",this.getTbccBrand());
 		
	
		map.put("tbccSort",this.getTbccSort());
 		
	
		map.put("tbccType",this.getTbccType());
 		
	
		map.put("tbccPicture",this.getTbccPicture());
 		
	
		map.put("tbccCommodity",this.getTbccCommodity());
 		
	
		map.put("tbccActivity",this.getTbccActivity());
 		
	
		map.put("suffix", this.suffix);
		
		/************LAZY3Q_DEFINE_TOMAP************/
		/************LAZY3Q_DEFINE_TOMAP************/
		return map;
	}
	/**map转对象**/
	public static TbCarouselConfig fromMap(Map map){
		TbCarouselConfig tbCarouselConfig = new TbCarouselConfig();
	
		tbCarouselConfig.tbccId = Utils.parseLong(map.get("tbccId"));
 		
	
		tbCarouselConfig.tbccBrand = Utils.parseLong(map.get("tbccBrand"));
 		
	
		tbCarouselConfig.tbccSort = Utils.parseInteger(map.get("tbccSort"));
 		
	
		tbCarouselConfig.tbccType = Utils.parseShort(map.get("tbccType"));
 		
	
		tbCarouselConfig.tbccPicture = Utils.parseString(map.get("tbccPicture"));
 		
	
		tbCarouselConfig.tbccCommodity = Utils.parseLong(map.get("tbccCommodity"));
 		
	
		tbCarouselConfig.tbccActivity = Utils.parseLong(map.get("tbccActivity"));
 		
	
		return tbCarouselConfig;
	}
	
	
	/**字段设置标记队列**/
	private Map<String,Boolean> seted=new HashMap();
	public Boolean getSeted(String key){
		return seted.get(key);
	}
	public void setSeted(String key){
		seted.put(key,true);
	}
	/**同步未set的字段**/
	public void mergeSet(TbCarouselConfig old){
		Field[] fields = this.getClass().getDeclaredFields();
		try {
			for(Field field:fields){
				String key = field.getName();
				if(seted.get(key)==null && field.getAnnotation(column.class)!=null){
					field.setAccessible(true);
					field.set(this, field.get(old));					
				}
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
		
	/**自定义变量存储**/
	private Map values=new HashMap();
	public Map getValues(){
		return values;
	}
	public void setValues(String name,Object value){
		values.put(name,value);
	}
	
	/**分表时的表名后缀**/
	private String suffix;
	public String getSuffix() {
		return suffix;
	}
	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}
	
	
	/**获取数据库名称**/
	public static String getDataBaseName(){
		return Utils.config("spring.datasource.distribute_sys.name");
	}
	
	
	public static String getIcon(){
		return "";
	}
	public static String getIconfont(){
		return "icon-libreoffice";
	}
	public static enum ACT{
		列表,添加,修改,详情
	};
	public static String getUrl(ACT act,TbCarouselConfig.M params){
		if(params==null)params=new TbCarouselConfig.M(0);
		params.remove("joins");
		params.remove("definexs");
		params.remove("distinct");
		String strUrl = "/admin/business/carouselconfig.edit.html?";
		if(params.get("tbccId")!=null){
			strUrl+="&id="+Utils.encode(""+params.get("tbccId"),Utils.UTF8);
		}
		if(act==ACT.列表){
			strUrl = "/admin/business/carouselconfig.html?1=1";
		
		}else if(act==ACT.添加){
			strUrl+="&edittype=insert";
		
		
		}else if(act==ACT.修改){
			strUrl+="&edittype=update";
		
		}else if(act==ACT.详情){
			strUrl+="&edittype=detail";
		
		}		
		if(params!=null){
			for(Object key:params.keySet()){
				strUrl+="&"+key+"="+Utils.encode(""+params.get(key),Utils.UTF8)+"";
			}
		}
		return strUrl;
	}
	public String getDetailUrl(){
		return this.getUrl(ACT.详情, where.tbccId(this.getId()));
	}
	
	/**
	* 转跳到当前地址
	**/
	public static Protocol redirect(TbCarouselConfig.ACT act,TbCarouselConfig.M params){
		Protocol protocol = Protocol.create(true,null,"ACT_REDIRECT");
		protocol.set("url",TbCarouselConfig.getUrl(act, params));
		return protocol;
	}
	/**
	* 打开一个新的tab页面
	**/
	public static Protocol href(TbCarouselConfig.ACT act,TbCarouselConfig.M params){
		Protocol protocol = Protocol.create(true,null,"ACT_HREF");
		protocol.set("url",TbCarouselConfig.getUrl(act, params));
		protocol.set("title",act.name());
		return protocol;
	}
	/**
	* 显示一个消息框，并且关闭当前的对话框
	**/
	public static Protocol message(String message){
		Protocol protocol = Protocol.create(true,null,"ACT_MESSAGE");
		protocol.set("message",message);
		return protocol;
	}
	
	
	static com.distribute.framework.dao.ITbCarouselConfigDao getTbCarouselConfigDao(){
		return Utils.getBean("tbCarouselConfigDao");
	};
	
}